package com.guangyunl.c_switch;

import java.util.Scanner;

public class Demo02Switch {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个整数: ");
        int data = sc.nextInt();
        //switch语句遇到break才会停止执行并跳出switch
        switch (data){
            case 1:
                System.out.println("语句一");
            case 2:
                System.out.println("语句二");
            case 3:
                System.out.println("语句三");
            default:
                System.out.println("默认语句");
                break;
        }
    }
}
